﻿@{
    ViewBag.Title = "积分转赠记录";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>

    $(function () {
        
        gridList();
    });

    function gridList() {
        var $gridList = $("#gridList");

        var postData = {
            YearRecord: $("#txt_startDate").val()
        };
        $gridList.dataGrid({
            url: "/BizManage/BalanceRecord/GetListForBalance",
            postData: postData,
            height: $(window).height() - 158,
            colModel: [
                {
                    label: '结算消费总金额(元)',
                    name: 'F_AllConsume',
                    width: 200,
                    align: 'center',
                    formatter: function (cellvalue, options, rowObject) {
                        return cellvalue == null ? "" : parseFloat(cellvalue).toFixed(2);
                    }
                },
                {
                    label: '结算分红总金额(元)',
                    name: 'F_AllBonus',
                    width: 200,
                    align: 'center',
                    formatter: function (cellvalue, options, rowObject) {
                        return cellvalue == null ? "" : parseFloat(cellvalue).toFixed(2);
                    }
                },
                { label: '时间时间', name: 'F_BalanceTime', width: 150, align: 'center' },
                {
                    label: '操作', name: '', width: 100, align: 'left', sortable: false,
                    formatter: function (cellvalue, options, rowObject) {
                        var str = "<a href='#' onclick='javascript:btn_details(\"" + rowObject.F_Id + "\")' style='text-decoration:underline;color:blue'>结算明细</a>";
                        return str;
                    }
                }
            ],
            pager: "#gridPager",
            sortname: 'F_BalanceTime desc',
            viewrecords: true
        });

        $("#btn_search").click(function() {
            var postData = {
                YearRecord: $("#txt_startDate").val()
            };
            $gridList.jqGrid('setGridParam',
            {

                postData: postData
            }).trigger('reloadGrid');
        });
    }

    function btn_details(keyValue) {
        if (keyValue != "") {
            $.modalOpen({
                id: "Details",
                title: "结算明细查看",
                url: "/BizManage/BalanceRecord/BalanceDetail?balanceId=" + keyValue,
                width: "900px",
                height: "550px",
                btn: null
            });
        } else {
            $.modalAlert("请先选择需要查看的结算记录！", "error");
        }
    }

</script>
<div class="topPanel">
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="代理商编号" style="width: 200px; margin-right:20px;">
                        
                        <input id="txt_startDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" placeholder="开始日期" style="width: 150px;"/>
                        --
                        <span style="float: right; margin-left: 3px;"> <input id="txt_endDate" type="text" class="form-control input-wdatepicker" onfocus="WdatePicker()" placeholder="结束日期" style="width: 150px;"/></span>
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" title="搜索"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()">
                <span class="glyphicon glyphicon-refresh"></span>
            </a>
        </div>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
